﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Liang.UI
{
    public partial class ProcessForm : Form
    {
        private string style = "process";

        public ProcessForm()
        {
            InitializeComponent();
        }

        public ProcessForm(string style)
        {
            InitializeComponent();
            this.style = style;
        }

        /// <summary>
        /// 设置提示信息
        /// </summary>
        public string MessageInfo
        {
            set
            {
                this.labelInfor.Text = value;
                this.label1_msg.Text = value;
            }
        }

        /// <summary>
        /// 设置进度条显示值
        /// </summary>            
        public int ProcessValue
        {
            set { this.progressBar1.Value = value; }
        }

        /// <summary>
        /// 设置进度条样式
        /// </summary>
        public ProgressBarStyle ProcessStyle
        {
            set { this.progressBar1.Style = value; }
        }

        /// <summary>
        /// 获取或设置进度条最大值
        /// </summary>
        public int MaxProcessValue
        {
            set { progressBar1.Maximum = value; }
            get { return progressBar1.Maximum; }
        }

        private void ProcessForm_Load(object sender, EventArgs e)
        {
            if ("process".Equals(style))
            {
                this.panel2.Visible = false;
                this.Height = this.panel1.Height;
                this.Width = this.panel1.Width;
            }
            else if ("waite".Equals(style))
            {
                Rectangle rect = new Rectangle();
                rect = Screen.GetWorkingArea(this);
                this.panel1.Visible = false;
                this.panel2.Width = 300;
                this.panel2.Height = 80;
                Size s = new Size(300, 80);
                this.Size = s;
                this.Left = rect.Width / 2 - 150;
                this.Top = rect.Height / 2 - 40;
            }
        }
    }
}
